using UnityEngine;

[CreateAssetMenu(fileName = "Ice and fire effect", menuName = "Data/Item effect/Ice and fire")]
public class IceAndFireEffect : ItemEffect
{
    [SerializeField] private GameObject prefab;
    [SerializeField] private Vector2 velocity;

    public override void ExecuteEffect(Transform transform, Player player)
    {
        bool thirdAttack = player.PrimaryAttackState.comboCounter >= 2;
        if (!thirdAttack)
            return;
        GameObject obj = Instantiate(prefab, transform.position, player.transform.rotation);
        velocity.x *= player.FacingDirection;
        obj.GetComponent<Rigidbody2D>().velocity = velocity;
        Destroy(obj, 5f);
    }
}
